package com.my.study.tx;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author Carlos
 * @version 1.0.0
 * @date 2022/11/8 22:15
 */
@Repository
public class SysDeptDao {
    
    
    @Autowired
    private JdbcTemplate jdbcTemplate;
    
    
    public void insert() {
        String sql = "INSERT INTO sys_dept (name, parent_id, sort) VALUES(?,?,?)";
        jdbcTemplate.update(sql, "部门3", 3L, 1);
    }

    public void update() {
        String sql = "update sys_dept set name = ? where id = ?";
        jdbcTemplate.update(sql, "部门4_1", 47);
    }

    public void update1() {
        String sql = "update sys_dept set name = ? where id = ?";
        jdbcTemplate.update(sql, "部门2_1", 51);
    }
}
